#pragma once

const ULONG MAX_SAMPLE_COUNT = 50; 

class CTimer
{
    bool				m_bPerfHardware;				// Has Performance Counter
	float				m_fTimeScale;					// Amount to scale counter
	float				m_fTimeElapsed;					// Time elapsed since previous frame
    __int64				m_i64CurrentPerformanceCounter; // Current Performance Counter
    __int64				m_i64LastPerformanceCounter;    // Performance Counter last frame
	__int64				m_i64PerformanceFrequency;      // Performance Frequency

    float				m_fFrameTimes[MAX_SAMPLE_COUNT];
    ULONG				m_nSampleCount;

    unsigned long		m_nCurrentFrameRate;            // Stores current framerate
	unsigned long		m_nFPSFrameCount;				// Elapsed frames in any given second
	float				m_fFPSTimeElapsed;				// How much time has passed during FPS sample
public:
	CTimer(void);
	~CTimer(void);

	void Tick(float fLockFPS = 0.0f);
    unsigned long GetFrameRate(LPTSTR lpszString = NULL) const;
    float GetTimeElapsed() const;
};
